package com.bite.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class BeanConfig {
    //    @Bean
//    public String name2(){
//        return "zhangsan";
//    }
    @Bean({"u1","uu"})
    public UserInfo userInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(2);
        userInfo.setName("lisi");
        userInfo.setAge(13);
        return userInfo;
    }

    @Bean
    public String name() {
        return "wangwu";
    }

    //    @Primary
    @Bean("u2")
    public UserInfo userInfo(String name) {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setName(name);
        userInfo.setAge(12);
        return userInfo;
    }

}
